<?php
/********************************************************
** Copyright 2010-2013. Todos los derechos reservados. **
** Desarrollado y Gestionado por:					   **
** Sugey Quintero (Analista)						   **
** José G. De Freitas (Programador)					   **
** Klaudia Uribe (Diseñadora Web)					   **
** Cesar Isturiz (Diseñador Web)					   **
**				S E A  v1.0							   **
*********************************************************/

session_start();
include("conexion2.php");

	if (isset($_SESSION['name']) and isset($_SESSION['tiempo'])) {
        include("Tiempo.php");
		date_default_timezone_set('America/Caracas'); setlocale(LC_TIME, 'spanish');
		$usuario = $_SESSION['name'];
		$fecha = date("Y-m-d H:i:s");
		$auditoria = mysql_query("INSERT INTO auditoria SELECT '$usuario', '$fecha' , 'Datos generales del estudiante liceo' ");

    }else {
		echo "<script>alert('Debe ingresar al sistema primero');</script>";
		echo "<script>document.location.href='index.php';</script>";
	}
include("conexion.php");
	
$cedula=$_GET['cedula'];

if($cedula){
	$existe=mysql_fetch_row(mysql_query("SELECT * FROM alumno WHERE CI_a='$cedula' "));
	if($existe[0] != ''){
		$row_a=mysql_fetch_array(mysql_query("SELECT inscripcion.periodo, alumno.*, inscripcion.repite, inscripcion.grado, inscripcion.seccion FROM alumno INNER JOIN inscripcion ON alumno.CI_a=inscripcion.cedula_a WHERE inscripcion.cedula_a='$cedula' "));
		$row_gf=mysql_fetch_array(mysql_query("select * from grupo_familiar where CI_gf=(select Grupo_familiar_CI_gf from grupo_familiar_has_alumno where Alumno_CI_a='$cedula')"));

		//$sql_mat=mysql_query("select nombre_m from materia where Cod_m in (select Materia_Cod_m from alumno_has_materia where Alumno_CI_a='$cedula')");	
		$sql_reca=mysql_fetch_array(mysql_query("select * from recaudos where CI_a='$cedula'"));
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Datos del estudiante</title>
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link href="style.css" rel="stylesheet" type="text/css" />
<!-- calendario-->
<link rel="stylesheet" type="text/css" href="src/css/jscal2.css" />
<link rel="stylesheet" type="text/css" href="src/css/border-radius.css" />
<link rel="stylesheet" type="text/css" href="src/css/steel/steel.css" />
<script type="text/javascript" src="src/js/jscal2.js"></script>
<script type="text/javascript" src="src/js/lang/es.js"></script>
<!-- fin calendario-->
<!-- botones-->
<link type="text/css" href="js/css/smoothness/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />      
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script src="js/prototype.js" type="text/javascript"></script>
<script>
var j$ = jQuery.noConflict();
j$(document).ready(function(){
j$(".button").button();
});

j$(function(){
	j$('#menu li a').click(function(event){
		var elem = j$(this).next();
		if(elem.is('ul')){
			event.preventDefault();
			j$('#menu ul:visible').not(elem).slideUp();
			elem.slideToggle();
		}
	});
});

function habilitar(form) {
  for (i=0; ele = form.elements[i]; i++)
    if (ele.type == 'text')
      ele.disabled = false;
	alert('Campos habilitados!');
}

//copiar de select a campo texto
/*oldvalue = "";
function passText(passedvalue) {
  if (passedvalue != "") {
    var totalvalue = oldvalue+passedvalue+", ";
    document.profe.materias.value = totalvalue;
    oldvalue = document.profe.materias.value;
  }
}*/

function comprobar_a()
{  
  //var url = 'http://sistemalamora.no-ip.org/sistema/sistema_liceo/comprobar_a.php';
  var url = 'http://127.0.0.1/sistema/sistema_liceo/comprobar_a.php';
  var pars= ('cedula=' + document.getElementById('cedula').value);
  var myAjax = new Ajax.Updater( 'comprobar_mensaje_a', url, { method: 'get', parameters: pars});
}

function verifyInput(_selList,_textBox,pos) {
	document.getElementById('cedula').readOnly = false;
	var SI = eval(_selList+".selectedIndex");
	var SV = eval(_selList+".options[SI].value");
	eval(_textBox+".value = SV");
	var a = eval(_selList+".options.selectedIndex=0");
	if (pos=='0'){
		document.buscador.cedula.focus();
	}
}
</script>
<!-- fin botones-->
</head>

<body>
<div id="wrap">
<div id="header">
<div id="hora">
<?php include("Hora.php"); ?>
</div>
<div id="topnav">
	<?php include("MenuSuperior.php"); ?>
</div>
</div>
<div id="content">
<div id="left">
<div class="post">
<div class="post_h">

</div>

<div class="postcontent">

<blockquote><h2 align="center">DATOS DEL ESTUDIANTE</h2></blockquote>
	<fieldset>
	<legend align=left><b><font size=2>BUSCADOR</font></b></legend>
		<form action=datos_gen_a.php method=get name=buscador>
		<table width=100% cellspacing=3 cellpadding=0 border=0>
			<tr>
				<td width=50% align=center>C&eacute;dula: <select name='Nac_e' onchange="verifyInput('document.buscador.Nac_e','document.buscador.cedula','0')"><option></option><option value='V-'>V-</option><option value='E-'>E-</option></select><input name='cedula' id='cedula' onKeyUp='comprobar_a(this.value)' onKeyPress='return acceptNum(event)' size=8 maxlength=10 readonly>
				<input class=button type=submit value=Buscar><br><span id='comprobar_mensaje_a'></td>
			</tr>
		</table>
		</form>
	</fieldset>

<div class="post">
<span></span></div>

<?php if ($row_a){
	echo "<fieldset>
			<legend align=left><b><font size=2>ESTUDIANTE</font></b></legend>
				<form action=res_datos_g_a.php method=POST>
				<table width=100% cellspacing=3 cellpadding=0 border=0>
					<tr>
						<td colspan=2 align=right>Per&iacute;odo: $row_a[0]</td>
					</tr>
					<tr>
						<td width=50%>C&eacute;dula: </td><td>$row_a[1]</td>
						<input type=hidden name=cedula value='$row_a[1]'>
					</tr>
					<tr>
						<td>Nombres: </td><td><input type=text name=nombre maxLength=25 size=35 value='$row_a[2]' disabled></td>
					</tr>
					<tr>	
						<td>Apellidos: </td><td><input type=text name=apellido maxLength=25 size=35 value='$row_a[3]' disabled></td>
					</tr>
					<tr>
						<td>Lugar de Nac.: </td><td><input type=text name=lugar_nac maxLength=25 size=35 value='$row_a[11]' disabled></td>
					</tr>
					<tr>	
						<td>Fecha de Nac.: </td><td><input type=text size=10 name=f_nac value='$row_a[10]' disabled></td>
					</tr>
					<tr>
						<td>Sexo: </td><td><input type=text size=2 name=sexo value='$row_a[12]' disabled></td>
					</tr>
					<tr>
						<td>Vive con: </td><td><input type=text name=vive size=3 value='$row_a[13]' disabled></td>
					</tr>
					<tr>	
						<td>Cantidad de Hermanos: </td><td><input type=text name=herma size=1 maxLength=1 value='$row_a[14]' disabled></td>
					</tr>
					<tr>	
						<td>Vive con Ellos: </td><td><input type=text name=vive_e size=1 value='$row_a[15]' disabled></td>
					</tr>
					<tr>
						<td>Direcci&oacute;n: </td><td><input type=text name=direc size=35 value='$row_a[9]' disabled></td>
					</tr>
					<tr>	
						<td>Peso: </td><td><input type=text name=peso size=3 maxLength=5 value='$row_a[4]' disabled> kg</td>
					</tr>
					<tr>	
						<td>Estatura: </td><td><input type=text name=estatura size=3 maxLength=5 value='$row_a[5]' disabled> mts</td>
					</tr>
					<tr>
						<th colspan=2>Talla</th>
					</tr>
					<tr>
						<td>Camisa/Pantal&oacute;n/Zapatos: </td><td><input type=text name=camisa size=1 value='$row_a[6]' disabled>/<input type=text name=pantalon size=1 maxLength=2 value='$row_a[7]' disabled>/<input type=text name=zapato size=1 maxLength=2 value='$row_a[8]' disabled></td>
					</tr>
					<tr>
						<td>Plantel de procedencia: </td><td><input type=text name=plantel_p size=35 value='$row_a[16]' disabled></td>
					</tr>
					<tr>
						<td>Repite </td><td>$row_a[18]</td>
					</tr>
					<tr>
						<td>Grado / Secci&oacute;n </td><td>$row_a[19] a&ntilde;o / $row_a[20]</td>
					</tr>";
					//<tr>
						//<td>Materias a cursar </td><td><select>"; while ($row_m=mysql_fetch_row($sql_mat)){ echo "<option>$row_m[0]</option>"; } echo "</select></td>
					//</tr>
				echo "</table>
				</fieldset>

<div class=post>
<span></span></div>

				<fieldset>
				<legend align=left><b><font size=2>REPRESENTANTE</font></b></legend>
				<table width=100% cellspacing=3 cellpadding=0 border=0>
				<tr><td><br></td></tr>
				<tr>
					<td width=50%>C&eacute;dula: </td><td>$row_gf[0]</td>
					<input type=hidden name=cedula_m value='$row_gf[0]'>
				</tr>
				<tr>
					<td>Nombres: </td><td><input type=text name=nombre_m size=35 maxLength=20 value='$row_gf[1]' disabled></td>
				</tr>
				<tr>	
					<td>Apellidos: </td><td><input type=text name=apellido_m size=35 maxLength=20 value='$row_gf[2]' disabled></td>
				</tr>
				<tr>
					<td>Edad: </td><td><input type=text name=edad_m size=2 maxLength=2 value='$row_gf[7]' disabled></td>
				</tr>
				<tr>	
					<td>Tel&eacute;fono: </td><td><input type=text name=telef_m size=35 maxLength=7 value='$row_gf[8]' disabled></td>
				</tr>
				<tr>	
					<td>Grado de Instrucci&oacute;n: </td><td>$row_gf[6]</td>
				</tr>
				<tr>
					<td>Direcci&oacute;n: </td><td><input type=text name=direc_m size=35 value='$row_gf[4]' disabled></td>
				</tr>
				<tr>
					<td>Ocupaci&oacute;n: </td><td><input type=text name=ocupacion_m size=35 maxLength=20 value='$row_gf[3]' disabled></td>
				</tr>
				<tr>	
					<td>Edo Civil: </td><td>$row_gf[5]</td>
				</tr>
			</table>
		</fieldset>

<div class=post>
<span></span></div>

		<fieldset>
		<legend align=left><b><font size=2>RECAUDOS ENTREGADOS</font></b></legend>
			<table width=100% cellspacing=3 cellpadding=0 border=0>
				<tr><td><br></td></tr>
				<tr><td width=33%>Partida de Nac.: <input type=text size=1 name=par_nac value='$sql_reca[1]' disabled></td>
					<td width=33%>Fotos Rep.: <input type=text size=1 name=fotos_r value='$sql_reca[2]' disabled></td>
					<td width=33%>Fotos Est.: <input type=text size=1 name=fotos_a value='$sql_reca[3]' disabled></td>
				</tr>
				<tr>
					<td>Fotocopia C.I. Est.: <input type=text size=1 name=c_ced_a value='$sql_reca[4]' disabled></td>
					<td>Fotocopia C.I. Rep.: <input type=text size=1 name=c_ced_r value='$sql_reca[5]' disabled></td>
					<td>Const. Est. a&ntilde;o ant.: <input type=text size=1 name=constancia_ant value='$sql_reca[6]' disabled></td>
				</tr>
				<tr>
					<td colspan=3 align=center><b>Alumno:</b> $sql_reca[7]</td>
				</tr>
			</table>
		</fieldset>

<div class=post>
<span></span></div>

<div id=botonera align=center>
	<input class=button type=button value=Modificar onclick='habilitar(this.form)'>
	<input class=button type=submit value=Guardar>
	<input class=button type=button value=Cancelar onClick=location='index.php'>
</div>
</form>";
}
?>

</div>
<div class="post_b">
<span></span></div>
</div>


</div>

<div class="post">
<div class="post_h">

</div>


</div>

<?php include("Menu.php"); ?>

<div class="clear"></div>
</div>
<div id="pagebottom"></div>

<div id="footer">
<P>&reg; Derechos Reservados @ CopyRight. 2011-2012</P>
<p>Programadores: Quintero E, Isturiz C, Uribe C, De Freitas J.</p>
</div>
</div>
</body>
</html>
